<?php     
if (!defined('IN_SONG')) exit('No direct script access allowed');
/**
 * OBJECT FORM
 * 
 * @author          DiepVD <diepvuongdac@vccorp.vn>
 * @package         Core
 * @subpackage      Form
 * @version         1.0
 * @copyright       VCCorp (c) 2010
 */ 
class FormHelper extends Object
{
    /**
    * Var name form
    * 
    * @var String
    */
    private $name;
    
    /**
    * Var submit
    * 
    * @var Boolean
    */
    private $isSubmit;
    
    function __construct($name)
    {  
        //parent::__construct($this->rules, $this->messages);
        $this->name = $name;
    }
    
    /**
     * Start form 
     * 
     * @param Boolean $upload Upload file
     * @param String $method Type submit
     * @param String $action Url
     * @return String
     * @access Public
     */
    public function begin($upload = false, $method = 'post', $action = false) {
        $html = '<form'. ($this->name ? ' name="'. $this->name .'"' : '') .' method="'. $method .'"'. ($upload ? ' enctype="multipart/form-data"' : '') . ($action ? ' action="'. $action .'"' : '') .'>';
        $html .= "\n" . '<input type="hidden" name="formid" value="" />';
        return $html;
    }
    
    /**
     * End form 
     * 
     * @return String
     * @access Public
     */
    public function end() {
        return '</form>';
    }
    
    /**
     * Submit Form 
     */
    public function isSubmit($arrOption = array())
    {           
        if(!self::$isSubmit || !empty($arrOption)) 
        {
            $this->isSubmit = true;    
            /*if(Module::$current)
            {
                if(isset($_REQUEST['form_page_id']))
                {
                    
                }
            } */
            
        }   
    }
}  
?>
